#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>

using namespace std;



//static.cpp
//#include<iostream>
//
//const int ArSize = 10;
//
//void strcount(const char* str);
//
//int main()
//{
//	char input[ArSize];
//	char next;
//	cout << "Enter a line:" << endl;
//	cin.get(input, ArSize);
//	while (cin)
//	{
//		cin.get(next);
//		while (next != '\n')
//			cin.get(next);
//		strcount(input);
//		cout << "Enter next line:(empty line to quit)" << endl;
//		cin.get(input, ArSize);
//	}
//	cout << "Bye\n";
//
//	return 0;
//}
//
//void strcount(const char* str)
//{
//	static int total = 0;
//	int count = 0;
//	cout << "\"" << str << "\" contains ";
//	while (*str++)
//		count++;
//	total += count;
//	cout << count << " characters\n";
//	cout << total << " characters total\n";
//}



//newplace.cpp
//#include<new>
//const int BUF = 512;
//const int N = 5;
//char buffer[BUF];
//int main()
//{
//	double* pd1, * pd2;
//	int i;
//	cout << "Calling new and placement new:\n";
//	pd1 = new double[N];
//	pd2 = new (buffer) double[N];
//	for (int i = 0; i < N; i++)
//		pd2[i] = pd1[i] = 1000 + 20.0 * i;
//	cout << "Memory addresses:\n" << " heap: " << pd1
//		<< " static: " << (void*)buffer << endl;
//	cout << "Memory contents:\n";
//	for (i = 0; i < N; i++)
//	{
//		cout << pd1[i] << " at " << &pd1[i] << " ; ";
//		cout << pd2[i] << " at " << &pd2[i] << endl;
//	}
//
//	cout << "\nCalling new and placement new a second time:\n";
//	double* pd3, * pd4;
//	pd3 = new double[N];
//	pd4 = new(buffer) double[N];
//	for (i = 0; i < N; i++)
//		pd3[i] = pd4[i] = 1000 + 40.0 * i;
//	cout << "Memry contents:\n";
//	for (i = 0; i < N; i++)
//	{
//		cout << pd3[i] << " at " << &pd3[i] << " ; ";
//		cout << pd4[i] << " at " << &pd4[i] << endl;
//	}
//
//	cout << "\nCalling new and placement new a third time:\n";
//	delete[] pd1;
//	pd1 = new double[N];
//	pd2 = new(buffer + N * sizeof(double)) double[N];
//	for (i = 0; i < N; i++)
//		pd2[i] = pd1[i] = 1000 + 60.0 * i;
//	cout << "Memry contents:\n";
//	for (i = 0; i < N; i++)
//	{
//		cout << pd1[i] << " at " << &pd1[i] << " ; ";
//		cout << pd2[i] << " at " << &pd2[i] << endl;
//	}
//	delete[] pd1;
//	delete[] pd3;
//	return 0;
//}	